package com.sxdx.utils;

import com.sxdx.entity.dto.SysUserDto;

/**
 * 保存用户信息的ThreadLocal
 */
public class UserHolder {
    private static final ThreadLocal<SysUserDto> tl = new ThreadLocal<>();

    public static void saveUser(SysUserDto user){
        tl.set(user);
    }

    public static SysUserDto getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
